package com.woniuxy.controller;

import com.woniuxy.ResponseEntity.ResponseEntity;
import com.woniuxy.dao.RbacRoleDao;
import com.woniuxy.entity.RbacRole;
import com.woniuxy.entity.RolerMenuDto;
import com.woniuxy.service.RbacRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/role")
public class RbacRoleController {
    @Autowired
    RbacRoleService rbacRoleService;

    @PostMapping("/findAllRole/{page}/{size}")
    public ResponseEntity findAllRole(@PathVariable("page") int page, @PathVariable("size") int size, @RequestBody RbacRole rbacRole){
       return rbacRoleService.findAllRole(page, size, rbacRole);
    };

    @RequestMapping("/findByid/{roleid}")
    public ResponseEntity findByid(@PathVariable("roleid") int roleid){
        return rbacRoleService.findByid(roleid);
    }

    @PostMapping("/saveMenu")
    public ResponseEntity updateRoleMenu(@RequestBody RolerMenuDto rolerMenuDto){
       return rbacRoleService.updateRoleMenu(rolerMenuDto);
    }
}
